package org.lld.im.service.user.controller;


import org.lld.im.common.ResponseVO;
import org.lld.im.service.user.model.req.GetUserInfoReq;
import org.lld.im.service.user.model.req.ModifyUserInfoReq;
import org.lld.im.service.user.model.req.UserId;
import org.lld.im.service.user.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @description:用户资料相关接口
 * @author: lld
 * @version: 1.0
 */
@RestController
@RequestMapping("v1/user/data")
public class ImUserDataController {

    private static Logger logger = LoggerFactory.getLogger(ImUserDataController.class);

    @Resource
    UserService imUserService;

    @GetMapping("/getUserInfo")
    public ResponseVO getUserInfo(@RequestBody GetUserInfoReq req, Integer appId){//@Validated
        req.setAppId(appId);
        return imUserService.getUserInfo(req);
    }

    @GetMapping("/getSingleUserInfo")
    public ResponseVO getSingleUserInfo(@RequestBody @Validated UserId req, Integer appId){
        req.setAppId(appId);
        return imUserService.getSingleUserInfo(req.getUserId(),req.getAppId());
    }

    @PutMapping("/modifyUserInfo")
    public ResponseVO modifyUserInfo(@RequestBody@Validated ModifyUserInfoReq req,Integer appId){
        req.setAppId(appId);
        return imUserService.modifyUserInfo(req);
    }
}
